package com.ross.mode.store;

import com.ross.mode.Product;
import lombok.extern.slf4j.Slf4j;

/**
 * @version 1.0.0
 * @className: ConcreteCreator
 * @description:
 * @author: zhangjunfa
 * @date: 2023/3/29 9:10
 */
@Slf4j
public class ConcreteCreator extends Creator {
    @Override
    public <T extends Product> T createProduct(Class<T> c) {
        Product product = null;
        try {
            product = (Product) Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            log.info("异常处理：{}", e.getMessage());
        }

        return (T) product;
    }
}
